﻿
using OpenCvSharp;

using Xc.DataAccess.Core;

namespace Xc.DataAccess.CodeReader.Models
{
    public class CVKeyPoint : ViewModelBase
    {
        private float size;
        private float angle = -1;
        private float response;
        private int octave;
        private int classId = -1;

        /// <summary>
        /// 位置
        /// </summary>
        public CVPointFloat Location { get; set; } = new CVPointFloat();
        /// <summary>
        /// 大小
        /// </summary>
        public float Size
        {
            get => size; set
            {
                size = value;
                RaisedPropertyChanged();

            }
        }
        /// <summary>
        /// 角度
        /// </summary>
        public float Angle
        {
            get => angle; set
            {
                angle = value; 
                RaisedPropertyChanged();

            }
        }         /// <summary>
                  /// 强度
                  /// </summary>
        public float Response
        {
            get => response; set
            {
                response = value;
                RaisedPropertyChanged();

            }
        }
        /// <summary>
        /// 在其中找到特征的尺度空间八度; 可能与大小有关
        /// </summary>
        public int Octave
        {
            get => octave; set
            {
                octave = value; 
                RaisedPropertyChanged();

            }
        }
        /// <summary>
        /// 点类
        /// </summary>
        public int ClassId
        {
            get => classId; set
            {
                classId = value;
                RaisedPropertyChanged();
            }
        }
        public static implicit operator KeyPoint(CVKeyPoint cVKeyPoint)
        {
            return new KeyPoint(cVKeyPoint.Location.X, cVKeyPoint.Location.Y, cVKeyPoint.Size, cVKeyPoint.Angle, cVKeyPoint.Response, cVKeyPoint.Octave, cVKeyPoint.ClassId);
        }
    }

}
